package com.caigp.cookbook2.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

public class CookBook implements Parcelable {

    private int id;

    private int classid;

    private String name;

    private String peoplenum;

    private String preparetime;

    private String cookingtime;

    private String content;

    private String pic;

    private String tag;

    private List<Material> material;

    private List<Process> process;

    protected CookBook(Parcel in) {
        id = in.readInt();
        classid = in.readInt();
        name = in.readString();
        peoplenum = in.readString();
        preparetime = in.readString();
        cookingtime = in.readString();
        content = in.readString();
        pic = in.readString();
        tag = in.readString();
        material = in.createTypedArrayList(Material.CREATOR);
        process = in.createTypedArrayList(Process.CREATOR);
    }

    public static final Creator<CookBook> CREATOR = new Creator<CookBook>() {
        @Override
        public CookBook createFromParcel(Parcel in) {
            return new CookBook(in);
        }

        @Override
        public CookBook[] newArray(int size) {
            return new CookBook[size];
        }
    };

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getClassid() {
        return classid;
    }

    public void setClassid(int classid) {
        this.classid = classid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPeoplenum() {
        return peoplenum;
    }

    public void setPeoplenum(String peoplenum) {
        this.peoplenum = peoplenum;
    }

    public String getPreparetime() {
        return preparetime;
    }

    public void setPreparetime(String preparetime) {
        this.preparetime = preparetime;
    }

    public String getCookingtime() {
        return cookingtime;
    }

    public void setCookingtime(String cookingtime) {
        this.cookingtime = cookingtime;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public List<Material> getMaterial() {
        return material;
    }

    public void setMaterial(List<Material> material) {
        this.material = material;
    }

    public List<Process> getProcess() {
        return process;
    }

    public void setProcess(List<Process> process) {
        this.process = process;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(id);
        dest.writeInt(classid);
        dest.writeString(name);
        dest.writeString(peoplenum);
        dest.writeString(preparetime);
        dest.writeString(cookingtime);
        dest.writeString(content);
        dest.writeString(pic);
        dest.writeString(tag);
        dest.writeTypedList(material);
        dest.writeTypedList(process);
    }

    public static class Material implements Parcelable {

        private String mname;

        private int type;

        private String amount;

        protected Material(Parcel in) {
            mname = in.readString();
            type = in.readInt();
            amount = in.readString();
        }

        public static final Creator<Material> CREATOR = new Creator<Material>() {
            @Override
            public Material createFromParcel(Parcel in) {
                return new Material(in);
            }

            @Override
            public Material[] newArray(int size) {
                return new Material[size];
            }
        };

        public String getMname() {
            return mname;
        }

        public void setMname(String mname) {
            this.mname = mname;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }

        public String getAmount() {
            return amount;
        }

        public void setAmount(String amount) {
            this.amount = amount;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(mname);
            dest.writeInt(type);
            dest.writeString(amount);
        }
    }

    public static class Process implements Parcelable {

        private String pcontent;

        private String pic;

        protected Process(Parcel in) {
            pcontent = in.readString();
            pic = in.readString();
        }

        public static final Creator<Process> CREATOR = new Creator<Process>() {
            @Override
            public Process createFromParcel(Parcel in) {
                return new Process(in);
            }

            @Override
            public Process[] newArray(int size) {
                return new Process[size];
            }
        };

        public String getPcontent() {
            return pcontent;
        }

        public void setPcontent(String pcontent) {
            this.pcontent = pcontent;
        }

        public String getPic() {
            return pic;
        }

        public void setPic(String pic) {
            this.pic = pic;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(pcontent);
            dest.writeString(pic);
        }
    }
}
